package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.PlanOffline;
import com.indusfo.spc.service.PlanOfflineService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author: 熊冰
 * @Date: 2019/11/11 10:29
 * 任务单维修流程
 */

@Controller
@RequestMapping("/planOffline")
public class PlanOfflineController {
	@Autowired
	private PlanOfflineService planOfflineService;

	//查询
	@RequestMapping(value="/queryPlanOffline")
	@ResponseBody
	public JSONObject queryPlanOffline(PlanOffline planOffline) {
		JSONObject json = planOfflineService.queryPlanOffline(planOffline);
		return json;
	}

	//新增
	@RequestMapping(value="/insertPlanOffline", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject insertPlanOffline(PlanOffline planOffline) {
		JSONObject json = planOfflineService.insertPlanOffline(planOffline);
		return json;
	}

	//修改
	@RequestMapping(value = "/updatePlanOffline",method= RequestMethod.POST)
	@ResponseBody
	public JSONObject updatePlanOffline (PlanOffline planOffline){
		JSONObject json=planOfflineService.updatePlanOffline(planOffline);
		return json;
	}

	//删除
	@RequestMapping(value="/deletePlanOffline", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject deletePlanOffline(@RequestParam("planOfflineIds") List<Integer> planOfflineIds, Integer dataState) {
		dataState = 2;
		JSONObject json = planOfflineService.deletePlanOffline(planOfflineIds, dataState);
		return json;
	}

	//启用
	@RequestMapping(value="/startPlanOffline", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject startPlanOffline(@RequestParam("planOfflineIds") List<Integer> planOfflineIds, Integer dataState) {
		dataState = 2;
		JSONObject json = planOfflineService.deletePlanOffline(planOfflineIds, dataState);
		return json;
	}

	//停用
	@RequestMapping(value="/stopPlanOffline", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject stopPlanOffline(@RequestParam("planOfflineIds") List<Integer> planOfflineIds, Integer dataState) {
		dataState = 2;
		JSONObject json = planOfflineService.deletePlanOffline(planOfflineIds, dataState);
		return json;
	}





}
